#!/usr/bin/env perl

use warnings;

# Use -d if you want only newgame ones (ie, without coloured dracs).
my $db = grep /^-d$/, @ARGV;

undef $/;
open IN, "util/cpp_version species-type.h|" or die "Can't read species-type.h\n";
$_ = <IN>;
close IN;

s/.*enum species_type.*\{(.*?)NUM_SPECIES.*/$1/s
    or die "Can't find species_type in species-type.h\n";

for (/SP_([A-Z_]+)/g)
{
    s/_/ /g;
    s/\b([A-Z])([A-Z]+)/\u$1\L$2/g;
    if ($db)
    {
        print "Draconian\n" if /Base Draconian/;
        next if /Draconian/;
    }
    print "$_\n";
}
